/**
 * 
 */

window.onload = function () {
	$('#bg').fadeIn(1);
	FullScreenBackground('#bgimg');
	}
	$(window).resize(function() {
	FullScreenBackground('#bgimg');
	});
	function FullScreenBackground(theItem){
	var winWidth=$(window).width();
	var winHeight=$(window).height();
	var imageWidth=$(theItem).width();
	var imageHeight=$(theItem).height();
	var picHeight = imageHeight / imageWidth;
	var picWidth = imageWidth / imageHeight;

		$('.down').css('width',$('.up').width());
	if ((winHeight / winWidth) < picHeight) {
		$(theItem).css("width",winWidth);
		$(theItem).css("height",picHeight*winWidth);
	} else {
		$(theItem).css("height",winHeight);
		$(theItem).css("width",picWidth*winHeight);
	};
	$(theItem).css("margin-left",winWidth / 2 - $(theItem).width() / 2);
	$(theItem).css("margin-top",winHeight / 2 - $(theItem).height() / 2);
	}
	
	/* Javascript Principal */
	
$(function(){
	 $winWidth = $(window).width();
	 
     if($winWidth < '1200'){
         $("[rel='gallery1']").fancybox({
         	openEffect	: 'none',
     		closeEffect	: 'none',
         	closeBtn : false,
         	theme     : 'default',
         	padding: 0,
         	margin:[10,10,10,10],
         	arrows:false,
         	caption:{type:'outside'},
				helpers : {
					
					thumbs : false,
				}
			});
         }else{
         	 $("[rel='gallery1']").fancybox({
              	openEffect	: 'none',
          		closeEffect	: 'none',
              	closeBtn : false,
              	theme     : 'default',
              	padding: 0,
              	margin:[10,10,10,10],
              	arrows:true,
              	caption:{type:'outside'},
  				helpers : {
  					
  					thumbs : true,
  				}
  			});

             }
})